home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / awe2-0_1.lha / awe2-0.1 / Src / RCS / LowerBoundedHeap.cc,v < prev    next >
Text File  |  1989-03-28  |  2KB  |  98 lines

  1. head     3.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    grunwald:3.2; strict;
  6. comment  @@;
  7.  
  8.  
  9. 3.2
  10. date     89.02.20.15.35.59;  author grunwald;  state Exp;
  11. branches ;
  12. next     3.1;
  13.  
  14. 3.1
  15. date     88.12.20.13.48.59;  author grunwald;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @@
  22.  
  23.  
  24. 3.2
  25. log
  26. @Start using Gnu library heaps for schedulers
  27. @
  28. text
  29. @// This may look like C code, but it is really -*- C++ -*-
  30. // 
  31. // Copyright (C) 1988 University of Illinois, Urbana, Illinois
  32. //
  33. // written by Dirk Grunwald (grunwald@@cs.uiuc.edu)
  34. //
  35. #include "LowerBoundedHeap.h"
  36. #include "CpuMultiplexor.h"
  37. #include "stream.h"
  38. #include "assert.h"
  39.  
  40. LowerBoundedHeap::LowerBoundedHeap(int defaultLength)
  41.     : (defaultLength), lowerBoundLock(0)
  42. {
  43.     //
  44.     // do nothing
  45.     //
  46. }
  47.  
  48. void LowerBoundedHeap::add(AwesimeHeapItem &t) {
  49.     LockedHeap::add(t);
  50.     lowerBoundLock.release();
  51. }
  52.  
  53. bool
  54. LowerBoundedHeap::remove(AwesimeHeapItem &item) {
  55.  
  56.     (void) lowerBoundLock.reserve();
  57.     bool ok = LockedHeap::remove(item);
  58.     //
  59.     //    The remove had better have worked, or there's something screwy
  60.     //  with the semaphores.
  61.     //
  62.     assert(ok);
  63.     return(ok);
  64. }
  65.  
  66. bool
  67. LowerBoundedHeap::doDelete(AwesimeHeapIndex& )
  68. {
  69.     assert(0);
  70.     return(0);
  71. }
  72.  
  73. unsigned int
  74. LowerBoundedHeap::size()
  75. {
  76.     return(AwesimeHeap::size());
  77. }
  78.  
  79. void LowerBoundedHeap::classPrintOn(ostream& s)
  80. {
  81.     s << "[LowerBoundedHeap " ;
  82.     s << "\tSemaphore\n";
  83.     s << lowerBoundLock;
  84.     s << "\n";
  85.     s << "\tHeap";
  86.     AwesimeHeap::classPrintOn(s);
  87.     s << "\n]\n" ;
  88. }
  89. @
  90.  
  91.  
  92. 3.1
  93. log
  94. @Steay version
  95. @
  96. text
  97. @@
  98.